#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    // 微调框

    // 再次实现一个点餐小功能，通过下拉框来选择食物，通过微调框来选择每个事物的数量

    // 初始化下拉菜单
    ui->comboBox->addItem("麦辣鸡腿堡");
    ui->comboBox->addItem("巨无霸汉堡");
    ui->comboBox->addItem("培根薯脆双层牛堡");

    ui->comboBox_2->addItem("中薯条");
    ui->comboBox_2->addItem("麦乐鸡块");
    ui->comboBox_2->addItem("麦辣鸡翅");

    ui->comboBox_3->addItem("可口可乐");
    ui->comboBox_3->addItem("百事可乐");
    ui->comboBox_3->addItem("雪碧");

    // 修改spinBox的一些属性

    // 设置范围
    ui->spinBox->setRange(1, 10);
    ui->spinBox_2->setRange(1, 10);
    ui->spinBox_3->setRange(1, 10);

    // 设置初始值
    ui->spinBox->setValue(1);
    ui->spinBox_2->setValue(1);
    ui->spinBox_3->setValue(1);

}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    qDebug() << "您选择的套餐为: " << ui->comboBox->currentText() << " : " << ui->spinBox->value() << "份" << " + " << ui->comboBox_2->currentText() << " : " << ui->spinBox_2->value() << "份"  << " + " << ui->comboBox_3->currentText() << " : " << ui->spinBox_3->value() << "份";

}
